package com.access.db;

/**
 * Created by hrd on 2016/7/13.
 */

import com.access.model.AccessPolicy;
import net.sf.json.JSONObject;

public class Policy {
    private Integer pid;
    private String ptype;
    private String operation;
    private String attributes;
    private String vectors;
    private Integer attributesNum;
    private Integer vectorsLength;
    private String description;
    private String xmlUrl;
    private Integer ownerId;
    private String policyName;

    public Policy() {
    }

    public Policy(JSONObject json, AccessPolicy accessPolicy) {
        this.ptype = json.getString("ptype");
        this.description = json.getString("description");
        this.policyName = json.getString("policyName");
        this.ownerId = Integer.valueOf(json.getInt("ownerId"));
        this.attributes = accessPolicy.getAttributes();
        this.vectors = accessPolicy.getVectors();
        this.attributesNum = Integer.valueOf(accessPolicy.getNumOfAttributes());
        this.vectorsLength = Integer.valueOf(accessPolicy.getLengthOfVector());
    }

    public Integer getPid() {
        return this.pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getPtype() {
        return this.ptype;
    }

    public void setPtype(String ptype) {
        this.ptype = ptype;
    }

    public String getOperation() {
        return this.operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public String getAttributes() {
        return this.attributes;
    }

    public void setAttributes(String attributes) {
        this.attributes = attributes;
    }

    public String getVectors() {
        return this.vectors;
    }

    public void setVectors(String vectors) {
        this.vectors = vectors;
    }

    public Integer getAttributesNum() {
        return this.attributesNum;
    }

    public void setAttributesNum(Integer attributesNum) {
        this.attributesNum = attributesNum;
    }

    public Integer getVectorsLength() {
        return this.vectorsLength;
    }

    public void setVectorsLength(Integer vectorsLength) {
        this.vectorsLength = vectorsLength;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getXmlUrl() {
        return this.xmlUrl;
    }

    public void setXmlUrl(String xmlUrl) {
        this.xmlUrl = xmlUrl;
    }

    public Integer getOwnerId() {
        return this.ownerId;
    }

    public void setOwnerId(Integer ownerId) {
        this.ownerId = ownerId;
    }

    public String getPolicyName() {
        return this.policyName;
    }

    public void setPolicyName(String policyName) {
        this.policyName = policyName;
    }
}
